<!-- 工资详情 -->
<template>
	<view>
		<bg-search placeholder="请输入班组姓名" @search="onSearch"></bg-search>
		<view class="mt-3 bg-white" v-if="dataList.length>0">
			<bg-cell2 v-for="i,ids in dataList" :key="ids" :showArrow="true" @tap="gotoDetail(i)">
				<template slot="label">
					<view class="flex font-12 font-bold font-gray3" >
						<view>{{i.recordUserName}}</view>
						<view> 
						<!-- <text class="mx-1">({{i.workJobTypeName}})</text> -->
						班组考勤表</view>
					</view>
				</template>
			</bg-cell2>
		</view>
		<u-empty v-else></u-empty>
	</view>
</template>

<script>
	import {getAttendTeam} from "@/api/attend.js"
	export default {
		data() {
			return {
				projectId:'',
				dataList:[],
				params:{
					projectId:'',
					recordUserName:'',
					pageNum:1,
					pageSize:10
				},
				total:0
			}
		},
		onLoad(options){
			this.params.projectId = options.pid
			this.getData()
		},
		methods: {
			onSearch(e){
				this.params.recordUserName = e
				this.dataList = []
				this.params.pageNum = 1
				this.getData()
			},
			getData(){
				getAttendTeam(this.params).then(res=>{
					this.dataList = [...this.dataList, ...res.data.rows]
					this.total = res.data.total
				})
			},
			loadMore() {
				if (this.dataList.length < this.total) {
					this.params.pageNum += 1
					this.getData()
				}
			},
			gotoDetail(i){
				uni.navigateTo({
					url:'/pages/attendance/attendance/table?projectId='+this.params.projectId+"&recordUserId="
					+ i.recordUserId+"&recordUserName="+i.recordUserName+"&workJobType="+i.workJobType
				})
			}
		}
	}
</script>

<style>

</style>
